#include <iostream>
#include <cmath>

using namespace std;

static int64_t sequence(int64_t n) {
    if (n == 1)
        return 1;
    else if (n == 2)
        return 2;
    else if (n % 2 == 0)
        return 2 * sequence(n / 2);
    else
        return sequence(n / 2) - 3 * sequence(n / 2 + 1);
}

int main() {
    cout << 4 - 2048 * sequence(static_cast<int64_t>(pow(5, 12))) << endl;
}